package cn.enilu.flash.bean.entity.cust;

import cn.enilu.flash.bean.entity.BaseEntity;
import lombok.Data;
import org.hibernate.annotations.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @Description
 * @Author Spark
 * @Date Created in (2019/11/04 9:20)
 * @Version v1.0
 * @Modify
 **/
@Entity(name="car_info")
@Table(appliesTo = "car_info",comment = "车辆信息")
@Data
@EntityListeners(AuditingEntityListener.class)
public class CarInfo extends BaseEntity {

    @Column(name = "cust_id", columnDefinition = "BIGINT COMMENT '客户'")
    @NotNull(message = "客户不能为空")
    private Long custId;

    @Column(name = "community_id", columnDefinition = "BIGINT COMMENT '社区'")
    @NotNull(message = "社区不能为空")
    private Long communityId;

    @Column(name = "car_no", columnDefinition = "VARCHAR(16) COMMENT '车牌号'")
    @NotNull(message = "车牌号不能为空")
    private String carNo;

    @Column(name = "vin", columnDefinition = "VARCHAR(64) COMMENT '车架号'")
    @NotNull(message = "车架号不能为空")
    private String vin;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "register_date", columnDefinition = "DATETIME COMMENT '注册日期'")
    private Date registerDate;

    @Column(name = "state", columnDefinition = "INT COMMENT '状态'")
    @NotNull(message = "状态不能为空")
    private Integer state;

    @Column(name = "electric_flag", columnDefinition = "INT COMMENT '是否新能源'")
    @NotNull(message = "新能源标识不能为空")
    private Integer electricFlag;

    @Column(name = "car_brand", columnDefinition = "VARCHAR(64) COMMENT '品牌'")
    private String carBrand;

    @Column(name = "car_model", columnDefinition = "INT COMMENT '型号'")
    private String carModel;
}
